From d39efc0388569a856de8003c2c6c4db03417db29 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Sun, 14 Sep 2014 22:01:21 -0700 Subject: [PATCH] ResourceLoaderWikiModule: Only check content format instead of namespace Follows up I64e86c741. Bug: 70835 Change-Id: Ieb9e5d045ed9b59cc83749234a9157689244c597 --- .../resourceloader/ResourceLoaderWikiModule.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/includes/resourceloader/ResourceLoaderWikiModule.php b/includes/resourceloader/ResourceLoaderWikiModule.php index 2eaca67961..3b4c3d9629 100644 --- a/includes/resourceloader/ResourceLoaderWikiModule.php +++ b/includes/resourceloader/ResourceLoaderWikiModule.php @@ -81,9 +81,15 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule { * @return null|string */ protected function getContent( $title ) { - if ( !$title->isCssJsSubpage() && !$title->isCssOrJsPage() ) { + $handler = ContentHandler::getForTitle( $title ); + if ( $handler->isSupportedFormat( CONTENT_FORMAT_CSS ) ) { + $format = CONTENT_FORMAT_CSS; + } elseif ( $handler->isSupportedFormat( CONTENT_FORMAT_JAVASCRIPT ) ) { + $format = CONTENT_FORMAT_JAVASCRIPT; + } else { return null; } + $revision = Revision::newFromTitle( $title, false, Revision::READ_NORMAL ); if ( !$revision ) { return null; @@ -96,14 +102,7 @@ abstract class ResourceLoaderWikiModule extends ResourceLoaderModule { return null; } - if ( $content->isSupportedFormat( CONTENT_FORMAT_JAVASCRIPT ) ) { - return $content->serialize( CONTENT_FORMAT_JAVASCRIPT ); - } elseif ( $content->isSupportedFormat( CONTENT_FORMAT_CSS ) ) { - return $content->serialize( CONTENT_FORMAT_CSS ); - } else { - wfDebugLog( 'resourceloader', __METHOD__ . ": bad content model {$content->getModel()} for JS/CSS page!" ); - return null; - } + return $content->serialize( $format ); } /* Methods */ -- 2.20.1